<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>我的配送地址簿</title>
    <link rel="stylesheet" href="__PUBLIC__/Home/css/personCenter/personAddr.css">
    <link href="__PUBLIC__/Home/css/personCenter/city-picker.css" rel="stylesheet" type="text/css" />
    <style media="screen">
      *{
        font-family: "黑体";
      }
    </style>
  </head>
  <body>
    <div class="myAddr">
      <!-- 标题 -->
      <p class="mytitle" style="margin-bottom:30px;">编辑收货地址</p>
      <!-- 新增配送地址表单开始 -->
      <form class="" action="{:U('personCenter/personSave')}" method="post">
        <input type="hidden" name="addr_id" value="{$list.addr_id}">
        <input type="hidden" name="user_id" value="{$list.user_id}">
        <label for="realname" class="mylabel">*请填写收货人真实姓名</label>
        <div class="mydiv">
          <input type="text" name="receiver" value="{$list.receiver}" class="myinput" style="width:140px;" id="receiver">
          <span id="receivertips" style="color:red"></span>
        </div>
        <label for="realplace" class="mylabel">*所属地区</label>
        <div class="mydiv" style="padding:0;height:47px;width:500px;">
            <!-- 全国三级联动js开始 -->
            <div id="distpicker" style="width:40px;">
                <div style="position: relative;">
                  <input id="city-picker3" name="area" class="form-control" readonly type="text"
                  data-toggle="city-picker" value="{$list.province}/{$list.city}/{$list.country}">
                </div>
            </div>
            <!-- 全国三级联动js结束 -->
        </div>
        <!-- 详细街道地址 -->
        <label for="addr_detai" class="mylabel">*街道地址(不需要重复填写省/市/区)</label>
        <div class="mydiv" >
          <input type="text" name="addr_detail" class="myinput" style="width:500px;" value="{$list.addr_detail}" id="addr_detail">
          <span id="addr_detailtips" style="color:red"></span>
        </div>
        <!-- 邮政编码 -->
        <label for="postcode" class="mylabel">*邮政编码</label>
        <div class="mydiv">
          <input type="text" name="postcode" class="myinput" style="width:140px;" value="{$list.postcode}" id="postcode">
          <span id="postcodetips" style="color:red"></span>
        </div>
        <!-- 电话号码 -->
        <label for="phone" class="mylabel">*手机号码</label>
        <div class="mydiv">
          <input type="text" name="phone" class="myinput" style="width:300px;" value="{$list.phone}" id="phone">
          <span id="phonetips" style="color:red"></span>
        </div>
        <div class="mydiv" style="margin-top:30px;">
          <input type="submit" value="确定" id="submit">
        </div>
      </form>
    </div>
  </body>
  <!-- 导入地区的三级联动开始 -->
  <script src="__PUBLIC__/Home/js/personCenter/jquery.js"></script>
  <script src="__PUBLIC__/Home/js/personCenter/city-picker.data.js"></script>
  <script src="__PUBLIC__/Home/js/personCenter/city-picker.js"></script>
  <script src="__PUBLIC__/Home/js/personCenter/main.js"></script>
  <!-- 地区三级联动结束 -->
  <script type="text/javascript">
    $('#checkbox').click(
      function(){
        if($(this).attr('sign')=='false'){
        $(this).css('background-color','#027BBB');
        $(this).attr('sign','true');
      }else {
        $(this).css('background-color','#FFF');
        $(this).attr('sign','false');
      }
    });
    window.onload = function(){
      var mywidth=document.body.scrollHeight;
      top.document.getElementById('show').innerHTML = mywidth;
      top.back();
    };
    // js页面验证提交的信息
    $(function(){

      var k1 = false;
      var k2 = false;
      var k3 = false;
      var k4 = false;
      $('#submit').on('click',function(){
        //1.验证收货人真实姓名
        var reg1= /^[\u4e00-\u9fa5]{2,12}$/;
        if(!reg1.test($("#receiver").val())){
            $("#receivertips").html("收货人姓名格式错误");
        }else{
            $("#receivertips").html("");
            k1=true;
        }
        // 2.验证邮政编码
        var reg2=/^\d{6}$/;
        if(!reg2.test($("#postcode").val())){
            $("#postcodetips").html("邮政编码输入错误");
        }else{
            $("#postcodetips").html("");
            k2=true;
        }
        /*3 .手机号验证*/
        var reg3= /^1[35689]\d{9}$/;
        if(!reg3.test($("#phone").val())){
            $("#phonetips").html("请输入11位手机号码");
        }else{
            $("#phonetips").html("");
            k3=true;
        }
        /*4 .详细地址的验证*/
          if($("#addr_detail").val()!=''&& $(".title").html()!=''){
            $("#addr_detailtips").html("");
            k4=true;
          }else{
            $("#addr_detailtips").html("请输入省份或详细地址");
          }

        if(k1 == true && k2 == true && k3 == true && k4 == true){

        }else{
          return false;
        }
      });
    });
  </script>
</html>
